import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;



public class GetEmail implements FilenameFilter {
	public String path="d:/mail1128";
	public HashMap mapexl=new HashMap();
	public HashMap doc=new HashMap();
	public List<String> open()
	{
		List<String> list=new ArrayList<String>();
		File file=new File(path);
		String name[]=file.list();
		for(int i=0;i<name.length;i++)
		{	int idex=name[i].indexOf("@");
			int idex1=name[i].indexOf("_", idex);
			try {
				String email=name[i].substring(0,idex1);
				if(name[i].endsWith("xls"))
				{
					mapexl.put(email, "1");
				}
				else
				{
					doc.put(email, "2");
				}
			} catch (Exception e) {
				// TODO: handle exception
			}
			
		
			
			
			
			
			
			
		}
		
		System.out.println(mapexl.size());
		System.out.println(doc.size());
		Object[] sdoc =  doc.keySet().toArray();
		for (int i = 0; i < sdoc.length; i++) {
			if(!mapexl.containsKey(sdoc[i])){
				list.add(sdoc[i].toString());
			}
		}
		return list;

	}
	public boolean accept(File arg0, String arg1) {
		arg1.matches(".*..doc");
		return false;
	}
	public static void main(String[] args){
		new GetEmail().open();
	}
	
}
